package ${poPackage};

import lombok.Getter;
import lombok.Setter;
import javax.persistence.*;
import org.springframework.data.jpa.domain.support.AuditingEntityListener;

import ${superPoClass};
<#if (classImport.datetime?string('1', '0'))=='1'>
import java.time.LocalDateTime;
</#if>
<#if (classImport.date?string('1', '0'))=='1'>
import java.time.LocalDate;
</#if>
<#if (classImport.timestamp?string('1', '0'))=='1'>
import java.sql.Timestamp;
</#if>
<#if (classImport.jsonformat?string('1', '0'))=='1'>
import com.fasterxml.jackson.annotation.JsonFormat;
</#if>
<#if (classImport.checkfield?string('1', '0'))=='1'>
import com.ajavaer.framework.common.validate.annotation.CheckField;
</#if>
<#if (classImport.bigdecimal?string('1', '0'))=='1'>
import java.math.BigDecimal;
</#if>
<#if classComment??>
/**
 * ${classComment}
 */
</#if>
@Entity
@Table(name = "${tableName}")
@Getter
@Setter
@EntityListeners({AuditingEntityListener.class})
public class ${className} extends ${superPoClassName} {

<#list classFields as field>
    <#if field.fieldComment??>/**${field.fieldComment}*/${'\n    '}</#if><#if field.fieldType == 'LocalDateTime'>@JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss")${'\n    '}</#if><#if field.fieldType == 'LocalDate'>@JsonFormat(pattern = "yyyy-MM-dd")${'\n    '}</#if><#if field.hasLob>@Lob${'\n    '}</#if>@Column(name = "${field.columnName}", columnDefinition="${field.dbType}<#if field.length??>(${field.length?c}<#if field.precision??>,${field.precision}</#if>)</#if> COMMENT '${field.fieldComment}' <#if field.defaultValue??> DEFAULT ${field.defaultValue}</#if>"<#if field.notNull>, nullable = false</#if>)<#if field.notNull>${'\n    '}@CheckField(message = "${field.fieldComment}不能为空", notEmpty = true)</#if>${'\n    '}private ${field.fieldType} ${field.fieldName};${'\n    '}
</#list>
}